package models

import (
	"time"
)

// AmsScmstoreProject 项目存储
type AmsScmstoreProject struct {
	ID   int    `db:"id" json:"id" comment:"主键ID"`
	Code string `db:"code" json:"code" comment:"项目编码"`
	Name string `db:"name" json:"name" comment:"项目名称"`
}

// AmsScmstoreReal 实体库表
type AmsScmstoreReal struct {
	ID       int    `db:"id" json:"id" comment:"主键ID"`
	Code     string `db:"code" json:"code" comment:"编码"`
	Name     string `db:"name" json:"name" comment:"名称"`
	PkOrg    string `db:"pk_org" json:"pk_org" comment:"组织主键"`
	OrgInuse int    `db:"org_inuse" json:"org_inuse" comment:"是否使用该库数据"`
	OrgCode  string `db:"org_code" json:"org_code" comment:"组织编码"`
}

// AuditAuditor 外部审计机构
type AuditAuditor struct {
	ID          int    `db:"id" json:"id" comment:"主键ID"`
	Name        string `db:"name" json:"name" comment:"审计方名"`
	IsActive    int    `db:"is_active" json:"is_active" comment:"是否激"`
	ForShort    string `db:"for_short" json:"for_short" comment:"审计方简"`
	Leader      string `db:"leader" json:"leader" comment:"审计负责"`
	ChargeType  int    `db:"charge_type" json:"charge_type" comment:"适用的计费方式（如方和方都适用，则"`
	ChargeLevel int    `db:"charge_level" json:"charge_level" comment:"对应计费方式的计费类"`
}

// AuditCipProject 在建工程项目
type AuditCipProject struct {
	ID          int     `db:"id" json:"id" comment:"主键ID"`
	ProjectCode string  `db:"project_code" json:"project_code" comment:"项目编码"`
	ProjectName string  `db:"project_name" json:"project_name" comment:"项目名称"`
	Money       float64 `db:"money" json:"money" comment:"项目在建余额"`
	Monthly     string  `db:"monthly" json:"monthly" comment:"统计日期（年月）"`
	OrgCode     string  `db:"org_code" json:"org_code" comment:"组织编码"`
	OrgName     string  `db:"org_name" json:"org_name" comment:"组织名称"`
	MoneyType   string  `db:"money_type" json:"money_type" comment:"金额类型"`
	CarryOver   int     `db:"carry_over" json:"carry_over" comment:"是否已审计存"`
}

// AuditCipSummary 在建工程汇总表
type AuditCipSummary struct {
	ID             int     `db:"id" json:"id" comment:"主键ID"`
	OrgCode        string  `db:"org_code" json:"org_code" comment:"组织编码"`
	OrgName        string  `db:"org_name" json:"org_name" comment:"组织名称"`
	Monthly        string  `db:"monthly" json:"monthly" comment:"统计月度（期末）"`
	MoneyStore     float64 `db:"money_store" json:"money_store" comment:"期初库存物资（实体库"`
	MoneyCip       float64 `db:"money_cip" json:"money_cip" comment:"期初在建工程余额（出库未结转"`
	MoneyBalance   float64 `db:"money_balance" json:"money_balance" comment:"期初工程物资余额（未出库"`
	MoneyTotal     float64 `db:"money_total" json:"money_total" comment:"库存余额合计（实在建工程+工程物资"`
	CarryOverCount int     `db:"carry_over_count" json:"carry_over_count" comment:"可结转项目数量（完审项目"`
	CarryOverMoney float64 `db:"carry_over_money" json:"carry_over_money" comment:"可结转项目金额（完审项目"`
}

// AuditContractor 承建单位
type AuditContractor struct {
	ID       int    `db:"id" json:"id" comment:"主键ID"`
	FullName string `db:"full_name" json:"full_name" comment:"承建单位全称"`
	ABB      string `db:"abb" json:"abb" comment:"承建单位简"`
}

// AuditLog 操作记录
type AuditLog struct {
	ID      int       `db:"id" json:"id" comment:"主键ID"`
	SqlText string    `db:"sql_text" json:"sql_text" comment:"SQL语句"`
	LogUser string    `db:"log_user" json:"log_user" comment:"用户"`
	LogTime time.Time `db:"log_time" json:"log_time" comment:"操作时间"`
	Version string    `db:"version" json:"version" comment:"客户端版"`
}

// AuditOperation 操作名称类型
type AuditOperation struct {
	ID     int    `db:"id" json:"id" comment:"主键ID"`
	Code   int    `db:"code" json:"code" comment:"操作代码"`
	Name   string `db:"name" json:"name" comment:"操作名称"`
	Remark string `db:"remark" json:"remark" comment:"备注"`
}

// AuditRate 审计费率
type AuditRate struct {
	ID         int     `db:"id" json:"id" comment:"主键ID"`
	Year       int     `db:"year" json:"year" comment:"年份"`
	Name       string  `db:"name" json:"name" comment:"费率名称"`
	Value      float64 `db:"value" json:"value" comment:"费率"`
	Type       int     `db:"type" json:"type" comment:"费率类型:金额; 1:比例）"`
	Level      int     `db:"level" json:"level" comment:"分级等级"`
	Upperlimit float64 `db:"upperlimit" json:"upperlimit" comment:"分级分段上限金额（包含）"`
	Lowerlimit float64 `db:"lowerlimit" json:"lowerlimit" comment:"分级分段下限金额（不包含"`
	Chargetype int     `db:"chargetype" json:"chargetype" comment:"计费类型:分段2:单一费率制）"`
}

// AuditReport 审计报告
type AuditReport struct {
	ID             int     `db:"id" json:"id" comment:"审计报告ID"`
	DispatchCode   string  `db:"dispatch_code" json:"dispatch_code" comment:"派审单号"`
	ConclusionCode string  `db:"conclusion_code" json:"conclusion_code" comment:"初审编号"`
	ReportCode     string  `db:"report_code" json:"report_code" comment:"审计报告编号"`
	ReportName     string  `db:"report_name" json:"report_name" comment:"审计报告名称（批次）"`
	OrgCode        string  `db:"org_code" json:"org_code" comment:"建设单位"`
	Auditor        int     `db:"auditor" json:"auditor" comment:"审计"`
	AuditMember    string  `db:"audit_member" json:"audit_member" comment:"审计人员"`
	ProjectCount   int     `db:"project_count" json:"project_count" comment:"报告包含项目数量"`
	ProjectCost    float64 `db:"project_cost" json:"project_cost" comment:"报告包含项目总造价（送审额）"`
	TotalReduction float64 `db:"total_reduction" json:"total_reduction" comment:"造价审减"`
	ReductionRatio float64 `db:"reduction_ratio" json:"reduction_ratio" comment:"人工审减"`
	ServeFee       float64 `db:"serve_fee" json:"serve_fee" comment:"基本审计服务"`
	BenifitFee     float64 `db:"benifit_fee" json:"benifit_fee" comment:"审计效益"`
	AuditFee       float64 `db:"audit_fee" json:"audit_fee" comment:"审计费用（服务费+效益费）"`
	FinalLabour    float64 `db:"final_labour" json:"final_labour" comment:"应付工程"`
	ReportDate     string  `db:"report_date" json:"report_date" comment:"报告日期"`
	IsPosted       int     `db:"is_posted" json:"is_posted" comment:"是否已下"`
	PostDate       string  `db:"post_date" json:"post_date" comment:"报告下发日期"`
	IsFiled        int     `db:"is_filed" json:"is_filed" comment:"是否已存"`
	FileDate       string  `db:"file_date" json:"file_date" comment:"存档日期"`
	IsReported     int     `db:"is_reported" json:"is_reported" comment:"是否出具报告"`
	Contractor     string  `db:"contractor" json:"contractor" comment:"承建单位"`
	Constructor    string  `db:"constructor" json:"constructor" comment:"施工负责"`
	Remark         string  `db:"remark" json:"remark" comment:"备注"`
	Fine           float64 `db:"fine" json:"fine" comment:"审计报告错误处罚罚金"`
}

// AuditStandingBook 工程审计台账
type AuditStandingBook struct {
	Asbid               int     `db:"asbid" json:"asbid" comment:"主键ID"`
	BatchCode           string  `db:"batch_code" json:"batch_code" comment:"报审批次"`
	SubmitDate          string  `db:"submit_date" json:"submit_date" comment:"送审日期"`
	DispatchCode        string  `db:"dispatch_code" json:"dispatch_code" comment:"派审单号"`
	OrgCode             string  `db:"org_code" json:"org_code" comment:"建设单位"`
	OrgName             string  `db:"org_name" json:"org_name" comment:"建设单位（区域）"`
	ProjectCode         string  `db:"project_code" json:"project_code" comment:"工程项目编号"`
	PmsCode             string  `db:"pms_code" json:"pms_code" comment:"工程管理系统对应编码"`
	ProjectName         string  `db:"project_name" json:"project_name" comment:"工程项目名称"`
	ProjectType         string  `db:"project_type" json:"project_type" comment:"项目类别：基础/集客"`
	BudgetLabour        float64 `db:"budget_labour" json:"budget_labour" comment:"预算人工"`
	BudgetMaterial      float64 `db:"budget_material" json:"budget_material" comment:"预算材料"`
	BudgetTotal         float64 `db:"budget_total" json:"budget_total" comment:"预算合计"`
	AcceptLabour        float64 `db:"accept_labour" json:"accept_labour" comment:"终验人工"`
	AcceptMaterial      float64 `db:"accept_material" json:"accept_material" comment:"终验材料"`
	AcceptTotal         float64 `db:"accept_total" json:"accept_total" comment:"终验工程投资合计（材人工"`
	Contractor          string  `db:"contractor" json:"contractor" comment:"工程承建单位"`
	Constructor         string  `db:"constructor" json:"constructor" comment:"施工负责"`
	AuditStatus         int     `db:"audit_status" json:"audit_status" comment:"当前审计流程状态码"`
	StatusTxt           string  `db:"status_txt" json:"status_txt" comment:"当前审计流程状态描"`
	ConclusionCode      string  `db:"conclusion_code" json:"conclusion_code" comment:"初审编号"`
	ConclusionPostDate  string  `db:"conclusion_post_date" json:"conclusion_post_date" comment:"审计意见下发日期"`
	IsOnsite            int     `db:"is_onsite" json:"is_onsite" comment:"是否现场审计"`
	Audited             int     `db:"audited" json:"audited" comment:"是否已审"`
	AuditMaterial       float64 `db:"audit_material" json:"audit_material" comment:"审计材料"`
	AuditLabour         float64 `db:"audit_labour" json:"audit_labour" comment:"审计人工"`
	Reduction           float64 `db:"reduction" json:"reduction" comment:"审减金额"`
	ReductionRatio      float64 `db:"reduction_ratio" json:"reduction_ratio" comment:"人工审减"`
	Reported            int     `db:"reported" json:"reported" comment:"是否出具审计报告"`
	ConclusionReplyDate string  `db:"conclusion_reply_date" json:"conclusion_reply_date" comment:"审计意见反馈日期"`
	ReportID            int     `db:"report_id" json:"report_id" comment:"审计报告ID"`
	AuditDate           string  `db:"audit_date" json:"audit_date" comment:"现场审计日期"`
	AuditTimes          int     `db:"audit_times" json:"audit_times" comment:"审计次数"`
	ServeFee            float64 `db:"serve_fee" json:"serve_fee" comment:"基本审计费用"`
	BenifitFee          float64 `db:"benifit_fee" json:"benifit_fee" comment:"审计效益"`
	AuditFee            float64 `db:"audit_fee" json:"audit_fee" comment:"审计服务审计效益"`
	FinalLabour         float64 `db:"final_labour" json:"final_labour" comment:"支付施工方费"`
	Remark              string  `db:"remark" json:"remark" comment:"特殊情况说明"`
	AuditPayYear        int     `db:"audit_pay_year" json:"audit_pay_year" comment:"审计费用结算年份"`
	Auditor             int     `db:"auditor" json:"auditor" comment:"审计"`
	HaveConclusion      int     `db:"have_conclusion" json:"have_conclusion" comment:"是否初审"`
	Cancelled           int     `db:"cancelled" json:"cancelled" comment:"是否终止/撤销/退"`
	Reportname          string  `db:"reportname" json:"reportname" comment:"报告名称"`
	Reportcode          string  `db:"reportcode" json:"reportcode" comment:"报告编码"`
	QiChu               int     `db:"qi_chu" json:"qi_chu" comment:"是否为平台期初数"`
	Reportsenddate      string  `db:"reportsenddate" json:"reportsenddate" comment:"报告发送日"`
	Reportfiledate      string  `db:"reportfiledate" json:"reportfiledate" comment:"报告存档日期"`
	AuditRemark         string  `db:"audit_remark" json:"audit_remark" comment:"审计情况说明"`
	AuditFeeAdd         float64 `db:"audit_fee_add" json:"audit_fee_add" comment:"其他审计费用"`
	PvCw                int     `db:"pv_cw" json:"pv_cw" comment:"签证或隐蔽工程资料问"`
	PdfBudget           string  `db:"pdf_budget" json:"pdf_budget" comment:"预算文档PDF"`
	PdfAccept           string  `db:"pdf_accept" json:"pdf_accept" comment:"验收文档PDF"`
	PdfAudit            string  `db:"pdf_audit" json:"pdf_audit" comment:"审计文档PDF"`
	BDR                 float64 `db:"bdr" json:"bdr" comment:"Budget deviation rate 预算偏差"`
}

// AuditStatus 当前项目审计状态表
type AuditStatus struct {
	ID   int    `db:"id" json:"id" comment:"主键ID"`
	Code int    `db:"code" json:"code" comment:"状态码"`
	Name string `db:"name" json:"name" comment:"状态名"`
}

// AuditTypeBill 库单类型
type AuditTypeBill struct {
	ID   int    `db:"id" json:"id" comment:"主键ID"`
	Name string `db:"name" json:"name" comment:"库单类型名称"`
}

// AuditTypeProject 工程项目分类
type AuditTypeProject struct {
	ID          int    `db:"id" json:"id" comment:"主键ID"`
	ProjectType string `db:"project_type" json:"project_type" comment:"项目类别"`
	SubType     string `db:"sub_type" json:"sub_type" comment:"子类"`
	TypeID      int    `db:"type_id" json:"type_id" comment:"类别ID"`
	SubID       int    `db:"sub_id" json:"sub_id" comment:"子类ID"`
	Content     string `db:"content" json:"content" comment:"解释"`
	FinanceNote string `db:"finance_note" json:"finance_note" comment:"财务对接"`
	Finance     int    `db:"finance" json:"finance" comment:"财务类别：资成本"`
	ProjectFile string `db:"project_file" json:"project_file" comment:"建档说明"`
}

// AuditUser 用户
type AuditUser struct {
	UID      int    `db:"uid" json:"uid" comment:"用户ID"`
	Username string `db:"username" json:"username" comment:"用户"`
	Password string `db:"password" json:"password" comment:"密码"`
	Level    int    `db:"level" json:"level" comment:"用户级别"`
}

// Project 项目
type Project struct {
	ID           int       `db:"id" json:"id"`
	Name         string    `db:"name" json:"name"`
	DesignCode   string    `db:"projectcode" json:"design_code"` //设计编码
	ApprovalCode string    `db:"pmscode" json:"approval_code"`   //立项编码
	OrgCode      string    `db:"org_code" json:"org_code"`       //建设单位编码
	Contractor   string    `db:"contractor" json:"contractor"`   //承建单位
	Constructor  string    `db:"constructor" json:"constructor"` //施工负责人
	Remark       string    `db:"remark" json:"remark"`
	Createtime   time.Time `db:"created_at" json:"created_at"`
	Updatetime   time.Time `db:"utime" json:"utime"`
}

// 项目预结算差异
type ProjectDiff struct {
	Design_Code  string  `db:"Design_Code" json:"design_code"`   //项目编码
	Project_Name string  `db:"Project_Name" json:"project_name"` //项目名称
	BudgetTotal  float64 `db:"Budget_Total" json:"budget_total"` //预算金额
	AcceptTotal  float64 `db:"Accept_Total" json:"accept_total"` //验收金额
	Diff_Total   float64 `db:"Diff_Total" json:"diff_total"`     //总金额差异
	Diff_Rate    float64 `db:"Diff_Rate" json:"diff_rate"`       //总金额差异率
}

// 项目预结算差异明细
type ProjectDiffDetail struct {
	Design_Code  string  `db:"Design_Code" json:"design_code"`   //项目编码
	Design_Type  int     `db:"Design_Type" json:"design_type"`   //设计类型 （预算/验收）
	Code         string  `db:"Code" json:"code"`                 //条目编码
	Name         string  `db:"Name" json:"name"`                 //条目名称
	Item_Type    string  `db:"Item_Type" json:"item_type"`       //条目类型 （1材料/2人工/3其它）
	Budget_Count float64 `db:"Budget_Count" json:"budget_count"` //预算数量
	Accept_Count float64 `db:"Accept_Count" json:"accept_count"` //验收数量
	Diff         float64 `db:"Diff" json:"diff"`                 //差异
	Diff_Status  string  `db:"Diff_Status" json:"diff_status"`   //差异状态 （超支 结余 相同）
	Remark       string  `db:"Remark" json:"remark"`
}
